package nl.sanity.events
{
	import flash.net.URLLoader;
	import flash.events.Event;
	
	/**
	 * XMLLoaderEvent
	 * For usage in combination with the XMLLoader class
	 * 
	 * @langversion ActionScript 3
	 *
	 * @author M.P. Bartnig
	 * @since  28/03/2009
	 */
	public class  XMLLoaderEvent extends Event
	{
		public static const ON_COMPLETE			: String	= "onComplete";
		public static const ON_ERROR			: String	= "onError";
		public static const ON_SECURITY_ERROR	: String	= "onSecurityError";
		
		private var _data						: XML;
		private var _error						: Object;
		
		// --- CONSTRUCTOR ----------------------------------------

		public function XMLLoaderEvent( type:String, data:XML = null, error:Object = null, bubbles:Boolean = false, cancelable:Boolean = false )
		{
			_data 	= data;
			_error 	= error;
			
			super ( type, bubbles, cancelable );
		}
		
		/**
		 * Creates and returns a copy of the current instance.
		 * @return a copy of the current instance.
		 */
		public override function clone():Event
		{
			return new XMLLoaderEvent( type, _data, _error, bubbles, cancelable );
		}
		
		// --- GETTERS/SETTERS ----------------------------------------

		public function get data():XML
		{
			return _data;
		}
		
		public function get error():Object
		{
			return _error;
		}
		
	}
}